package com.atguigu.gmall.cart.config;


import com.atguigu.gmall.cart.interceptor.AuthInterceptor;
import com.atguigu.gmall.common.execption.handler.GlobalExceptionController;
import com.atguigu.gmall.common.interceptor.feign.anntation.EnableFeignHeaderInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@EnableFeignHeaderInterceptor
@Import(GlobalExceptionController.class)  //导入全局异常处理功能
@Configuration
public class CartAppWebConfig implements WebMvcConfigurer {


    //把所有的拦截器都注册到 InterceptorRegistry
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new AuthInterceptor()).addPathPatterns("/api/cart/**", "/api/inner/cart/**");
    }


}
